package com.example.mapper.Dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.domain.entity.Person;
import com.example.mapper.PersonMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

@Component
@Primary
public class PersonDao extends BaseDao<Person, PersonMapper> implements PersonMapper{
    @Autowired
    private PersonMapper personMapper;

    @Override
    protected BaseMapper<Person> getMapper() {
        return personMapper;
    }

    @Override
    public String getPersonName(Integer personId) {
        Person person = this.selectById(personId);
        if(person != null) {
            return person.getPersonName();
        }
        return null;
    }
}
